package com.gyc.demo.system.controller;

import com.gyc.demo.common.util.vcode.VerifyCodeUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author gyc
 * @date 2018/4/4
 */
@Controller
public class LoginController {
    @GetMapping("/gifCode")
    public void getGifCode(HttpServletResponse response, HttpServletRequest request){
        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        response.setContentType("image/jpeg");
        VerifyCodeUtils.outputVerifyImage(146,33,request,response,4);
    }
    @RequestMapping(value = {"","/"})
    public String goLogin(){
        return "login";
    }
    @RequestMapping(value = "/login")
    public String login(@RequestParam(name = "username",required = false)String username){
        return "success";
    }
}
